package com.wanjia.order.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wanjia.order.server.entity.Prodect;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProdectMapper extends BaseMapper<Prodect> {
    @Select("SELECT pd.prodect_details_id, pd.prodect_details_name,pic.pic_src,p.price,t.prodect_type_details_name ,p.count,od.count as orderQuantity \n" +
            "FROM prodect p\n" +
            "INNER JOIN prodect_type_details t \n" +
            "ON t.prodect_type_details_code=p.prodect_type_details_code\n" +
            "LEFT  JOIN pic \n" +
            "ON pic.prodect_id=p.prodect_id\n" +
            "INNER JOIN prodect_details pd \n" +
            "ON p.prodect_id=pd.prodect_id\n" +
            "LEFT JOIN user_order_details od\n" +
            "ON od.prodect_details_id=  pd.prodect_details_id GROUP BY pd.prodect_details_name ORDER BY pd.prodect_details_id ASC \n")
    List<Prodect> prodectListAll();
}
